//
//  TZBaseScrollView.swift
//  SimpleTZ
//
//  Created by wangfeng on 2020/7/13.
//  Copyright © 2020 davis. All rights reserved.
//

import UIKit

class TZBaseScrollView: UIScrollView {
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

    override func didMoveToSuperview() {
        super.didMoveToSuperview()
        if #available(iOS 11.0, *) {
            self.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never
        } else {
            self.tz_controller?.automaticallyAdjustsScrollViewInsets = false
        }
    }
}

class TZBaseTableView: UITableView {
    override init(frame: CGRect, style: UITableView.Style) {
        super.init(frame: frame, style: style)
        self.estimatedRowHeight = 0
        self.sectionHeaderHeight = 0
        self.sectionFooterHeight = 0
        if #available(iOS 11.0, *) {
                  self.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never
            }
              if #available(iOS 9.0, *) {
                  self.cellLayoutMarginsFollowReadableWidth = false
        }
        
    }
    
    override func didMoveToSuperview() {
        super.didMoveToSuperview()
        if #available(iOS 11.0, *) {
            self.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never
        } else {
            self.tz_controller?.automaticallyAdjustsScrollViewInsets = false
        }
    }
    
    
    required init?(coder aDecoder: NSCoder) {
         fatalError("init(coder:) has not been implemented")
     }
     
}

